Principal Type Schemes for Functional Programs with Overloading and Subtyping
نویسنده
چکیده
We show how the Hindley/Milner polymorphic type system can be extended to incorporate overloading and subtyping. Our approach is to attach constraints to quantified types in order to restrict the allowed instantiations of type variables. We present an algorithm for inferring principal types and prove its soundness and completeness. We find that it is necessary in practice to simplify the inferred types, and we describe techniques for type simplification that involve shape unification, strongly connected components, transitive reduction, and the monotonicities of type formulas.
منابع مشابه
Type inference for MLj
MLj is an extension of the Standard ML language which allows interoperation with Java. It has a type system which combines ML’s parametric polymorphism and type inference with Java’s subtyping (class hierarchy) and arbitrary overloading of methods. In this paper, we discuss some of the difficulties in implementing type inference for MLj and outline our progress on the implementation. In particu...
متن کاملCoherence for qualified types
The meaning of programs in a language with implicit overloading can be described by translating them into a second language that makes the use of overloading explicit. A single program may have many distinct translations and it is important to show that any two translations are semantically equivalent to ensure that the meaning of the original program is well-defined. This property is commonly ...
متن کاملCombining Inheritance and Parametric Polymorphism in a Functional Database Language
We consider extending a functional database language to support subtyping, inheritance and method overloading. We do so by extending previous work on type inference with subtypes for the pure calculus to cater for structured types, ML-style parametric polymorphism and overloaded function deenitions. We attach semantics to overloaded functions by developing a generalisation of best-t pattern-mat...
متن کاملA static semantics for Haskell
This paper gives a static semantics for Haskell 98, a non-strict purely functional programming language. The semantics formally speciies nearly all the details of the Haskell 98 type system, including the resolution of overloading, kind inference (including defaulting) and polymorphic recursion, the only major omission being a proper treatment of ambiguous overloading and its resolution. Overlo...
متن کاملOrder-Sorted Inductive Types
System F ! is an extension of system F ! with subtyping and bounded quantiication. Order-sorted algebra is an extension of many-sorted algebra with overloading and subtyping. We combine both formalisms to obtain IF ! , a higher-order typed-calculus with subtyping, bounded quan-tiication and order-sorted inductive types, i.e. data types with built-in subtyping and overloading. Moreover we show t...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- Sci. Comput. Program.
دوره 23 شماره
صفحات -
تاریخ انتشار 1994